
/*

DEPENDENCIES:
-------------
Gimme.Style
ext.for_each
-------------


IN THIS FILE:
-------------
ext.set_style
-------------

*/

(function()
{
	var setOpacity = Gimme.Style.set_opacity;
	var getCamelizedStyle = Gimme.Style.get_camelized_style_name;
	Gimme.ext.set_style = function(dict)
	{
		this.for_each(function(elem)
		{
			var key, val, camelizedStyle
			for (key in dict)
			{
				val = dict[key];
				camelizedStyle = getCamelizedStyle(key);
				
				switch (camelizedStyle)
				{
					case 'height':
					case 'maxHeight':
					case 'minHeight':
					case 'width':
					case 'maxWidth':
					case 'minWidth':
					case 'top':
					case 'right':
					case 'bottom':
					case 'left':
					case 'marginTop':
					case 'marginRight':
					case 'marginBottom':
					case 'marginLeft':
					case 'paddingTop':
					case 'paddingRight':
					case 'paddingBottom':
					case 'paddingLeft':
						elem.style[camelizedStyle] = typeof val === 'number' && val + 'px' || val;
						break;
					case 'opacity':
						setOpacity(elem, val);
						break;						
					default:
						elem.style[camelizedStyle] = val;
						break;
				}
			}
		});
		return this;
	};
	//[AltSyntax]Gimme.ext.setStyle = Gimme.ext.set_style;
})();